home *** CD-ROM | disk | FTP | other *** search
/ IRIX Installation Tools & Overlays 2002 November / SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso / dist / motif21_dev.idb / usr / Motif-2.1 / include / Xm / TextFP.h.z / TextFP.h
C/C++ Source or Header  |  2002-10-15  |  14KB  |  346 lines

  1. /* 
  2.  *  @OSF_COPYRIGHT@
  3.  *  COPYRIGHT NOTICE
  4.  *  Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  5.  *  ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  6.  *  the full copyright text.
  7.  */ 
  8. /* 
  9.  * HISTORY
  10. */ 
  11. /* $TOG: TextFP.h /main/17 1997/03/04 17:00:01 dbl $ */
  12. /* (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  13. #ifndef _XmTextFP_h
  14. #define _XmTextFP_h
  15.  
  16. #include <Xm/Xm.h>
  17. #include <Xm/PrimitiveP.h>
  18. #include <Xm/TextF.h>
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. /*
  25.  * Defines for different cursors
  26.  */
  27.  
  28. #define IBEAM_WIDTH    3
  29. #define CARET_WIDTH    9
  30. #define CARET_HEIGHT    5
  31.  
  32. /*
  33.  * Here is the Text Field Widget class structure.
  34.  */
  35.  
  36. typedef struct _XmTextFieldClassPart {
  37.   XtPointer extension;        /* Pointer to extension record. */
  38.   
  39. #ifdef _SGIMOTIF
  40.   _SgClassExtension    _SG_vendorExtension;
  41. #endif
  42.  
  43. } XmTextFieldClassPart;
  44.  
  45. typedef struct _XmTextFieldClassRec {
  46.   CoreClassPart core_class;  /* Not RectObjClassPart so I can reference
  47.                   core_class s */
  48.   XmPrimitiveClassPart primitive_class;
  49.   XmTextFieldClassPart text_class;
  50. } XmTextFieldClassRec;
  51.  
  52. externalref XmTextFieldClassRec xmTextFieldClassRec;
  53. #ifdef _SGIMOTIF
  54.  
  55. typedef struct __SG_XmTextFieldExtPart {
  56.         
  57.     Pixel   selection_background; /* color of the selected text background */
  58.     Pixel    selection_foreground; /* color of the selected text foreground */
  59.     Pixel    error_background;/* color of the selected error text background */
  60.     Boolean  cursor_visible_on_focus; /* If true then cursor is visible
  61.                        only when is has the keyboard focus */
  62.     Boolean  post_motion_call;  /* If true then extra textVerifyCallback is made */
  63.   
  64. } _SG_XmTextFieldExtPart;
  65.  
  66. typedef struct __SG_XmTextFieldExt {
  67.         
  68.     _SgInstanceExtensionRec common;   /* Stuff all instance rec's have */
  69.     _SG_XmTextFieldExtPart  rsrc;     /* Resources & instance var's */
  70.   
  71. } _SG_XmTextFieldExtRec, *_SG_XmTextFieldExt;
  72.  
  73. #define _SG_TextFieldPtr(w) ((_SG_XmTextFieldExt)(((XmTextFieldWidget)(w))->text._SG_vendorExtension))
  74.  
  75. #endif /* _SGIMOTIF */
  76. /*
  77.  * On the spot support.
  78.  */
  79. typedef struct _OnTheSpotData {
  80.   XmTextPosition start;
  81.   XmTextPosition end;
  82.   XmTextPosition cursor;
  83.   int over_len;
  84.   int over_maxlen;
  85.   char *over_str;
  86.   int under_preedit;
  87.   Boolean under_verify_preedit;
  88.   Boolean verify_commit;
  89.   int pad;
  90. } OnTheSpotDataRec, *OnTheSpotData;
  91.  
  92. /*
  93.  * Here is the Text Field Widget instance structures.
  94.  */
  95.  
  96. typedef struct _XmTextFieldPart {
  97.     XtCallbackList activate_callback;           /* Command activate callback */
  98.     XtCallbackList focus_callback;             /* Verify gain focus callback */
  99.     XtCallbackList losing_focus_callback;      /* Verify losing focus 
  100.                           callback */
  101.     XtCallbackList modify_verify_callback;     /* Verify value to change 
  102.                           callback */
  103.     XtCallbackList wcs_modify_verify_callback; /* Verify value to change 
  104.                           callback */
  105.     XtCallbackList motion_verify_callback;     /* Verify insert cursor position
  106.                           to change callback */
  107.     XtCallbackList gain_primary_callback;      /* Gained ownership of Primary
  108.                           Selection */
  109.     XtCallbackList lose_primary_callback;      /* Lost ownership of Primary
  110.                           Selection */
  111.     XtCallbackList value_changed_callback;     /* Notify that value has changed
  112.                           callback */
  113.     char * value;        /* pointer to widget value stored as char * */
  114.     wchar_t * wc_value;        /* pointer to widget value stored as 
  115.                    wchar_t * */
  116.  
  117.     XmFontList font_list;    /* Uses only the font portion of fontlist */
  118.     XFontStruct *font;            /* font retrieved from the fontlist */
  119.     XmTextScanType *selection_array; /* Description of what to cycle
  120.                     through on selections */
  121.     _XmHighlightData highlight;      /* Info on the highlighting regions. */
  122.  
  123.     GC gc;            /* Normal GC for drawing text and cursor */
  124.     GC image_gc;        /* Image GC for drawing text cursor*/
  125.     GC save_gc;                 /* GC for saving/restoring under IBeam */
  126.  
  127.     Pixmap ibeam_off;        /* pixmap for area under the IBeam */
  128.     Pixmap add_mode_cursor;    /* The add mode cursor pixmap */
  129.     Pixmap cursor;        /* The ibeam cursor stencil */
  130.     Pixmap putback;        /* AVAILABLE: was in 1.1 but not really used */
  131.     Pixmap stipple_tile;    /* The tile pattern for the stippled I-beam */
  132.     Pixmap image_clip;        /* AVAILABLE: was in 1.2 but not used now */
  133.  
  134.     XmTextPosition cursor_position;  /* Character location of the insert 
  135.                     cursor */
  136.     XmTextPosition new_h_offset;     /* AVAILABLE: was in 1.1 but not used */
  137.     XmTextPosition h_offset;           /* The x position of the first character
  138.                     (relative to left edge of widget) */
  139.     XmTextPosition orig_left;        /* Left primary selection prior to 
  140.                     extend */
  141.     XmTextPosition orig_right;       /* Right primary selection prior to
  142.                     extend */
  143.     XmTextPosition prim_pos_left;    /* Left primary selection position */
  144.     XmTextPosition prim_pos_right;   /* Right primary selection position */
  145.     XmTextPosition prim_anchor;         /* Primary selection pivot point */
  146.  
  147.     XmTextPosition sec_pos_left;     /* Left secondary selection position */
  148.     XmTextPosition sec_pos_right;    /* Right secondary selection position */
  149.     XmTextPosition sec_anchor;         /* Secondary selection pivot point */
  150.  
  151.     XmTextPosition stuff_pos;    /* Position to stuff the primary selection */
  152.  
  153.     Position select_pos_x;      /* x position for timer-based scrolling */
  154.  
  155.     Time prim_time;             /* Timestamp of primary selection */
  156.     Time dest_time;             /* Timestamp of destination selection */
  157.     Time sec_time;              /* Timestamp of secondary selection */
  158.     Time last_time;             /* Time of last selection event */
  159.  
  160.     XtIntervalId timer_id;    /* Blinking cursor timer */
  161.     XtIntervalId select_id;     /* Timer based scrolling identifier */
  162.  
  163.     int blink_rate;        /* Rate of blinking text cursor in msec */
  164.     int selection_array_count;  /* Selection array count */
  165.     int threshold;        /* Selection threshold */
  166.     int size_allocd;        /* Size allocated for value string */
  167.     int string_length;          /* The number of characters in the string 
  168.                    (including the trailing NULL) */
  169.     int cursor_height;        /* Save cursor dimensions */
  170.     int cursor_width;        /* Save cursor dimensions */
  171.     int sarray_index;        /* Index into selection array */
  172.     int max_length;        /* Maximum number of character that can be
  173.                    inserted into the text field widget */
  174.  
  175.     int max_char_size;          /* Max bytes per character in cur locale */
  176.     short columns;        /* The number of characters in the width */
  177.  
  178.     Dimension margin_width;    /* Height between text borders and text */
  179.     Dimension margin_height;    /* Width between text borders and text */
  180.     Dimension average_char_width;   /* Average character width based on font */
  181.     Dimension margin_top;       /* Height between text borders and top of 
  182.                    text */
  183.     Dimension margin_bottom;    /* Height between text borders and bottom of 
  184.                    text */
  185.     Dimension font_ascent;      /* Ascent of font or fontset used by widget */
  186.     Dimension font_descent;     /* Descent of font or fontset used by widget */
  187.  
  188.     Boolean resize_width;    /* Allows the widget to grow horizontally
  189.                    when borders are reached */
  190.     Boolean pending_delete;    /* Delete primary selection on insert when
  191.                    set to True */
  192.     Boolean editable;        /* Sets editablility of text */
  193.     Boolean verify_bell;        /* Determines if bell is sounded when verify
  194.                    callback returns doit - False */
  195.     Boolean cursor_position_visible; /* Sets visibility of insert cursor */
  196.  
  197.     Boolean traversed;          /* Flag used with losing focus verification to
  198.                                    indicate a traversal key pressed event */
  199.     Boolean add_mode;        /* Add mode for cursor movement */
  200.     Boolean has_focus;        /* Flag that indicates whether the widget
  201.                        has input focus */
  202.     Boolean blink_on;        /* State of Blinking insert cursor */
  203.     short int cursor_on;    /* Indicates whether the cursor is visible */
  204.     Boolean refresh_ibeam_off;    /* Indicates whether the area under IBeam needs
  205.                    to be re-captured */
  206.     Boolean have_inverted_image_gc;  /* fg/bg of image gc have been swapped */
  207.     Boolean has_primary;    /* Indicates that is has the
  208.                    primary selection */
  209.     Boolean has_secondary;    /* Indicates that is has the
  210.                    secondary selection */
  211.     Boolean has_destination;    /* Indicates that is has the
  212.                    destination selection */
  213.     Boolean sec_drag;           /* Indicates a secondary drag was made */ 
  214.     Boolean selection_move;    /* Indicates that the action requires a
  215.                    secondary move (i.e. copy & cut) */
  216.     Boolean pending_off;    /* indicates pending delete state */
  217.     Boolean fontlist_created;   /* Indicates that the text field widget created
  218.                    it's own fontlist */
  219.     Boolean has_rect;        /* currently has clipping rectangle */
  220.     Boolean do_drop;        /* Indicates that the widget the recieved the
  221.                    button release, did not have a previous
  222.                                    button press, so it is o.k. to request
  223.                    the MOTIF_DROP selection. */
  224.     Boolean cancel;        /* Cancels selection actions when true */
  225.     Boolean extending;        /* Indicates extending primary selection */
  226.     Boolean sec_extending;      /* Indicates extending secondary selection */
  227.     Boolean changed_visible;    /* Indicates whether the dest_visible flag
  228.                                    is in a temporary changed state */
  229.     Boolean have_fontset;       /* The widgets font is a fontset, not a 
  230.                    fontstruct... use R5 draw routines */
  231.     Boolean in_setvalues;    /* used to disable unnecessary redisplays */
  232.     Boolean do_resize;        /* used to prevent inappropriate resizes */
  233.     Boolean redisplay;        /* used to set redisplay flag in setvalues */
  234.     Boolean overstrike;        /* overstrike mode for character input */
  235.     Boolean sel_start;        /* overstrike mode for character input */
  236.     XtPointer extension;    /* Pointer to extension record. */
  237.  
  238. #ifdef _SGIMOTIF
  239.     _SG_XmTextFieldExt    _SG_vendorExtension;
  240. #endif
  241.  
  242.     XtCallbackList  destination_callback;   /* Selection destination cb */
  243.     Boolean selection_link;    /* Indicates that the action requires a
  244.                    link */
  245.     /* New for 2.0 */
  246.     Boolean take_primary;    /* Indicates that is has to take the
  247.                    primary selection */
  248.     GC cursor_gc;               /* 1-bit depth GC for creating the I-beam 
  249.                    stipples (normal & add mode) */
  250.     XtIntervalId drag_id;       /* timer to start btn1 drag */
  251.     _XmTextActionRec *transfer_action;  /* to keep track of delayed action */
  252.     /* Boolean rt_save; */         /* used for MT work */
  253.     OnTheSpotData onthespot;    /* data for on-the-spot im support */
  254.  
  255.     Boolean check_set_render_table; /* used for MT safe work */
  256.     Boolean programmatic_highlights;    /* XmTextFieldSetHighlight called */
  257. } XmTextFieldPart;
  258.  
  259. typedef struct _XmTextFieldRec {
  260.     CorePart core;
  261.     XmPrimitivePart primitive;
  262.     XmTextFieldPart text;
  263. } XmTextFieldRec;
  264.  
  265.  
  266. /****************
  267.  *
  268.  * Macros for the uncached data
  269.  *
  270.  ****************/
  271.  
  272. #define TextF_ActivateCallback(tfg)    \
  273.     (((XmTextFieldWidget)(tfg)) -> text.activate_callback)
  274. #define TextF_LosingFocusCallback(tfg)    \
  275.     (((XmTextFieldWidget)(tfg)) -> text.losing_focus_callback)
  276. #define TextF_FocusCallback(tfg)    \
  277.     (((XmTextFieldWidget)(tfg)) -> text.focus_callback)
  278. #define TextF_ModifyVerifyCallback(tfg)    \
  279.     (((XmTextFieldWidget)(tfg)) -> text.modify_verify_callback)
  280. #define TextF_ModifyVerifyCallbackWcs(tfg) \
  281.     (((XmTextFieldWidget)(tfg)) -> text.wcs_modify_verify_callback)
  282. #define TextF_MotionVerifyCallback(tfg)    \
  283.     (((XmTextFieldWidget)(tfg)) -> text.motion_verify_callback)
  284. #define TextF_ValueChangedCallback(tfg)    \
  285.     (((XmTextFieldWidget)(tfg)) -> text.value_changed_callback)
  286. #define TextF_Value(tfg)        \
  287.     (((XmTextFieldWidget)(tfg)) -> text.value)
  288. #define TextF_WcValue(tfg)        \
  289.     (((XmTextFieldWidget)(tfg)) -> text.wc_value)
  290. #define TextF_MarginHeight(tfg)        \
  291.     (((XmTextFieldWidget)(tfg)) -> text.margin_height)
  292. #define TextF_MarginWidth(tfg)        \
  293.     (((XmTextFieldWidget)(tfg)) -> text.margin_width)
  294. #define TextF_CursorPosition(tfg)    \
  295.     (((XmTextFieldWidget)(tfg)) -> text.cursor_position)
  296. #define TextF_Columns(tfg)        \
  297.     (((XmTextFieldWidget)(tfg)) -> text.columns)
  298. #define TextF_MaxLength(tfg)        \
  299.     (((XmTextFieldWidget)(tfg)) -> text.max_length)
  300. #define TextF_BlinkRate(tfg)        \
  301.     (((XmTextFieldWidget)(tfg)) -> text.blink_rate)
  302. #define TextF_FontList(tfg)        \
  303.     (((XmTextFieldWidget)(tfg)) -> text.font_list)
  304. #define TextF_Font(tfg)            \
  305.     (((XmTextFieldWidget)(tfg)) -> text.font)
  306. #define TextF_FontAscent(tfg)        \
  307.     (((XmTextFieldWidget)(tfg)) -> text.font_ascent)
  308. #define TextF_FontDescent(tfg)        \
  309.     (((XmTextFieldWidget)(tfg)) -> text.font_descent)
  310. #define TextF_SelectionArray(tfg)    \
  311.     (((XmTextFieldWidget)(tfg)) -> text.selection_array)
  312. #define TextF_SelectionArrayCount(tfg)    \
  313.     (((XmTextFieldWidget)(tfg)) -> text.selection_array_count)
  314. #define TextF_ResizeWidth(tfg)        \
  315.     (((XmTextFieldWidget)(tfg)) -> text.resize_width)
  316. #define TextF_PendingDelete(tfg)    \
  317.     (((XmTextFieldWidget)(tfg)) -> text.pending_delete)
  318. #define TextF_Editable(tfg)        \
  319.     (((XmTextFieldWidget)(tfg)) -> text.editable)
  320. #define TextF_CursorPositionVisible(tfg) \
  321.     (((XmTextFieldWidget)(tfg)) -> text.cursor_position_visible)
  322. #define TextF_Threshold(tfg)        \
  323.     (((XmTextFieldWidget)(tfg)) -> text.threshold)
  324. #define TextF_UseFontSet(tfg)        \
  325.     (((XmTextFieldWidget)(tfg)) -> text.have_fontset)
  326.  
  327. /*
  328.  * On the spot support.
  329.  */
  330. #define PreStart(tfg)                           (((XmTextFieldWidget)(tfg)) -> \
  331.                                            text.onthespot->start)
  332. #define PreEnd(tfg)                             (((XmTextFieldWidget)(tfg)) -> \
  333.                                            text.onthespot->end)
  334. #define PreCursor(tfg)                          (((XmTextFieldWidget)(tfg)) -> \
  335.                                            text.onthespot->cursor)
  336. #define FUnderVerifyPreedit(tfg)          (((XmTextFieldWidget)(tfg)) -> \
  337.                      text.onthespot->under_verify_preedit)
  338. #define FVerifyCommitNeeded(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  339.                      text.onthespot->verify_commit)
  340.  
  341. #ifdef __cplusplus
  342. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  343. #endif
  344.  
  345. #endif /* _XmTextFieldWidgetP_h */
  346.